package com.nbsaas.boot.evaluate.rest.convert;

import com.nbsaas.boot.entity.evaluate.EvaluateCatalog;
import com.nbsaas.boot.evaluate.api.domain.response.EvaluateCatalogResponse;

import com.nbsaas.boot.utils.BeanDataUtils;
import com.nbsaas.boot.rest.api.Converter;
/**
* 评价分类-实体对象转化成响应对象
*/

public class EvaluateCatalogResponseConvert  implements Converter<EvaluateCatalogResponse,EvaluateCatalog> {

    @Override
    public EvaluateCatalogResponse convert(EvaluateCatalog source) {
        EvaluateCatalogResponse  result = new  EvaluateCatalogResponse();
        BeanDataUtils.copyProperties(source, result);
                    if(source.getParent()!=null){
                        result.setParent(source.getParent().getId());
                    }

                    try {
                        if(source.getParent()!=null){
                            result.setParentName(source.getParent().getName());
                        }
                    } catch (Exception ignored) { }

        return result;
    }

}

